home *** CD-ROM | disk | FTP | other *** search
/ InterCD 1999 June / june_1999.iso / Palm / Business / TC Logger / callback.h next >
Encoding:
C/C++ Source or Header  |  1999-03-09  |  855 b   |  27 lines

  1. ///////////////////////////////////////////////////////////////////////////
  2. // callback.h
  3.  
  4. #ifdef __CALLBACK_H__
  5. #error __CALLBACK_H__ already defined!
  6. #else
  7. #define __CALLBACK_H__
  8. #endif
  9.  
  10. /*
  11.     This is a workaround for a bug in the current version of gcc: gcc assumes 
  12.     that no one will touch %a4 after it is set up in crt0.o.  This isn't true 
  13.     if a function is called as a callback by something that wasn't compiled by 
  14.     gcc (like FrmCloseAllForms()).  It may also not be true if it is used as a 
  15.     callback by something in a different shared library.  We really want a 
  16.     function attribute "callback" which will insert this progloue and 
  17.     epilogoue automatically. - Ian
  18. */
  19.  
  20.  
  21. register void *reg_a4 asm("%a4");
  22.  
  23. #define CALLBACK_PROLOGUE void *save_a4 = reg_a4; asm("move.l %%a5,%%a4; sub.l #edata,%%a4" : :);
  24.  
  25. #define CALLBACK_EPILOGUE reg_a4 = save_a4;
  26.  
  27.